<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'activity.label', default: 'Activity')}" />
        <title>预约task</title>
    </head>
    <body>
    <div class="small-header">
        <div class="hpanel">
            <div class="panel-body">
                <div id="hbreadcrumb" class="pull-right">
                    <ol class="hbreadcrumb breadcrumb">
                        <li>Next CRM</li>
                        <li>
                            <g:link controller="activity" action="index">预约</g:link>
                        </li>
                        <li class="active">
                            <span>预约编辑</span>
                        </li>
                    </ol>
                </div>
                <h2 class="font-light m-b-xs">
                    预约编辑
                </h2>
            </div>
        </div>
    </div>
    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                <div class="panel-tools">
                </div>
                    预约编辑
                </div>
                <div class="panel-body">
                    <g:form resource="${this.activity}" method="PUT" class="form-horizontal">
                        <div class="hpanel hblue">
                            <div class="panel-heading">
                                关联对象
                            </div>

                            <div class="panel-body">
                                <!--当 flag = true， 跳转到 订单详情页-->
                                <g:textField class="form-control" type="text" name="flag" value="${this.params?.flag}" />

                                <div class="form-group row">
                                    <label class="col-md-2 control-label">客户</label>
                                    <div class="col-md-3">
                                        <g:select class="form-control" name="account.id" value="${this.activity?.account?.id}" optionValue="account" optionKey="accountId"
                                          from="${com.next.AccountTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}"/>
                                    </div>

                                    <label class="col-md-2 control-label">联系人</label>
                                    <div class="col-md-3">
                                        <g:select class="form-control" name="contact" value="${this.activity?.contact?.id}" id="contact" optionValue="fullName" optionKey="id" from="${com.next.Contact.findAllByActive(true)}" noSelection="${['': '请选择']}" />
                                    </div>
                                </div>

                                <div class="form-group row">
                                    <label class="col-md-2 control-label">商机</label>
                                    <div class="col-md-3">
                                        <g:if test="${this.params?.flag}">
                                            <input type="hidden" name="opportunity" value="${this.activity?.opportunity?.id}">
                                            <g:select class="form-control" name="opportunity" value="${this.activity?.opportunity?.id}" id="opportunity" optionValue="serialNumber" optionKey="id" from="${com.next.Opportunity.list()}" noSelection="${['': '请选择']}"/>
                                        </g:if>
                                        <g:else>
                                            <g:select class="form-control" name="opportunity" value="${this.activity?.opportunity?.id}" id="opportunity" optionValue="serialNumber" optionKey="id" from="${com.next.Opportunity.list()}" noSelection="${['': '请选择']}" />
                                        </g:else>
                                    </div>

                                    <label class="col-md-2 control-label">资产</label>
                                    <div class="col-md-3">
                                        <g:select id="asset" name='asset.id' value="${this.activity?.asset?.id}" from='${com.next.Asset.list()}' optionKey="id" optionValue="name" class="form-control" noSelection="${['':'请选择']}"></g:select>
                                    </div>
                                </div>

                                <div class="form-group row">
                                    <label class="col-md-2 control-label">市场活动</label>
                                    <div class="col-md-3">
                                        <g:select id="campaign" name='campaign.id' value="${this.activity?.campaign?.id}" from='${com.next.Campaign.findAllByActive(true)}' optionKey="id" optionValue="name" class="form-control" noSelection="${['':'请选择']}"></g:select>
                                    </div>

                                    <label class="col-md-2 control-label">反馈</label>
                                    <div class="col-md-3 datePicker">
                                        <g:select id="issue" name='issue.id' value="${this.activity?.issue?.id}" from='${com.next.Issue.list()}' optionKey="id" class="form-control" noSelection="${['':'请选择']}"></g:select>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <div class="hpanel hblue">
                            <div class="panel-heading">
                                活动信息
                            </div>

                            <div class="panel-body">
                                <!--当 flag = true， 跳转到 订单详情页-->
                                <g:textField class="form-control hide" type="text" name="flag" value="${this.params?.flag}" />

                                <div class="form-group row">
                                    <label class="col-md-2 control-label is-required">标题</label>
                                    <div class="col-md-3">
                                        <g:textField class="form-control" type="text" name="name" value="${this.activity?.name}" />
                                    </div>

                                    <label class="col-md-2 control-label is-required">执行人</label>
                                    <div class="col-md-3 datePicker">
                                        <g:select id="assignedTo" name='assignedTo.id' noSelection="${['':'请选择']}" value="${this.activity?.assignedTo?.id}" from='${com.next.User.list()}' optionKey="id" class="form-control"></g:select>
                                    </div>
                                </div>



                                <div class="form-group row">
                                    <label class="col-md-2 control-label">类型</label>
                                    <div class="col-md-3">
                                        <g:select id="type" name='type' value="${com.next.ActivityType.findByName('Task')?.id}" from='${com.next.ActivityType.list()}' optionKey="id" optionValue="name" class="form-control"></g:select>
                                    </div>

                                    <label class="col-md-2 control-label is-required">子类型</label>
                                    <div class="col-md-3">
                                        <g:select id="subtype" name='subtype.id' noSelection="${['':'请选择']}" value="${this.activity?.subtype?.id}" from='${com.next.ActivitySubtype.findAllByType(com.next.ActivityType.findByName('Task'))}' optionKey="id" optionValue="name" class="form-control"></g:select>
                                    </div>
                                </div>



                                <div class="form-group row">
                                    <label class="col-md-2 col-form-label is-required">计划开始时间</label>

                                    <div class="col-md-3 datePicker">
                                        %{--<g:datePicker name="startTime" value="${this.activity?.startTime}" precision="minute"/>--}%
                                        <div class="input-group ">
                                            <input type="text" valctrl="startTime" value="${this.activity?.startTime}" class="form-control form_datetime">
                                            <input type="hidden" id="startTime" name="startTime" value="date.struct">
                                            <input type="hidden" id="startTime_minute" name="startTime_minute" value="">
                                            <input type="hidden" id="startTime_hour" name="startTime_hour" value="">
                                            <input type="hidden" id="startTime_day" name="startTime_day" value="">
                                            <input type="hidden" id="startTime_month" name="startTime_month" value="">
                                            <input type="hidden" id="startTime_year" name="startTime_year" value="">
                                        </div>
                                    </div>
                                    <label class="col-md-2 col-form-label is-required">计划结束时间</label>

                                    <div class="col-md-3 datePicker">
                                        <g:datePicker name="endTime" value="${this.activity?.endTime}" precision="minute"/>
                                    </div>
                                </div>



                                <div class="form-group row">
                                    <label class="col-md-2 control-label is-required">状态</label>
                                    <div class="col-md-3">
                                        <g:select class="form-control" name="status" noSelection="${['':'请选择']}" from="${this.activity.constrainedProperties.status.inList}" value="${this.activity?.status}" />
                                    </div>
                                    <label class="col-md-2 control-label">城市</label>
                                    <div class="col-md-3">
                                        <g:textField class="form-control" type="text" name="city" value="${this.activity?.city}" />
                                    </div>
                                </div>


                                <div class="form-group row">
                                    <label class="col-md-2 control-label">地址</label>
                                    <div class="col-md-3">
                                        <g:textField class="form-control" type="text" name="address" value="${this.activity?.address}" />
                                    </div>
                                </div>


                                <div class="form-group row">
                                    <label class="col-md-2 control-label">描述</label>
                                    <div class="col-md-8">
                                        <g:textArea rows="3" class="form-control" name="description" id="description" value="${this.activity?.description}" />
                                    </div>
                                </div>



                                <div class="form-group row">
                                    <div class="col-md-12">
                                        <g:submitButton class="btn btn-info" name="update" value="保存" />
                                    </div>
                                </div>

                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>
    </div>
    </body>
</html>
